package com.itchen.hospital.mapper;

import com.itchen.hospital.pojo.Admin;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface LoginMapper {
    /**
     * 角色为admin
     * @param account
     * @return
     */
    @Select("select * from admin where account = #{account}")
    Admin getAdminByAccount(String account);

    @Insert("insert into admin(account,password,role) values(#{account},#{password},#{role})")
    void insertAdmin(Admin admin);

    /**
     * 角色为doctor
     * @param account
     * @return
     */
    @Select("select * from doctor where account = #{account}")
    Admin getDoctorByAccount(String account);

    @Insert("insert into doctor(account,password,role) values(#{account},#{password},#{role})")
    void insertDoctor(Admin admin);

    /**
     * 角色为user
     * @param account
     * @return
     */
    @Select("select * from user where account = #{account}")
    Admin getUserByAccount(String account);

    @Insert("insert into user(account,password,role) values(#{account},#{password},#{role})")
    void insertUser(Admin admin);
}
